home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
lcppb.zip
/
LCPPANS.ZIP
/
RECT.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-08
|
979b
|
50 lines
// rect.cpp -- Rectangle class
#include <iostream.h>
#include "disp.h"
class rectangle {
private:
int top, left, bottom, right;
public:
rectangle(int x1, int y1, int x2, int y2)
{ top = y1; left = x1; bottom = y2; right = x2; }
void showRect(void);
};
main()
{
disp_open();
disp_move(0, 0);
disp_eeop();
rectangle rect(10, 4, 70, 16);
rect.showRect();
disp_move(24, 0);
disp_close();
}
void twoChar(int x1, int y1, int x2, int y2)
{
disp_move(y1, x1);
disp_putc('#');
disp_move(y2, x2);
disp_putc('#');
}
void rectangle::showRect(void)
{
int i;
for (i = left; i <= right; i++)
twoChar(i, top, i, bottom);
for (i = top; i <= bottom; i++)
twoChar(left, i, right, i);
}
// Copyright (c) 1990 by Tom Swan. All rights reserved
// Revision 1.00 Date: 12/05/1990 Time: 09:58 am
// Revision 1.01 Date: 07/08/1991 Time: 05:41 pm
// Converted for Borland C++ 2.0